Skip to content

fix: refresh DTF and token prices on the quote cadence - #39

Open
devin-ai-integration[bot] wants to merge 1 commit into
mainfrom
devin/1784923622-price-refresh-cadence
Open

fix: refresh DTF and token prices on the quote cadence#39
devin-ai-integration[bot] wants to merge 1 commit into
mainfrom
devin/1784923622-price-refresh-cadence

Conversation

@devin-ai-integration

Copy link
Copy Markdown
Contributor

Summary

The USD value shown for the token being redeemed, and the price impact of every quote, was computed from a DTF price fetched once at widget mount and never refreshed, while the quote itself refreshed every refreshRate (9s). Since 2.7.1 both legs' USD values and priceImpact/truePriceImpact are derived from Reserve prices in applyPricing, so a frozen DTF price directly skews what the user sees, and it gets worse the longer the widget stays open (Register sets refetchOnWindowFocus: false, so nothing ever re-triggered the fetch).

Both price queries now run on the quote's own cadence, so the two legs are always priced from the same moment: the current/dtf query in use-index-basket.ts gains refetchInterval/staleTime = refreshRateAtom (9s default), and usePrice moves off its independent 30s/15s timers onto the same value.

tests/price-refresh.test.tsx pins the cadence for both queries (fails without the change, passes with it). Version bumped to 2.7.3 — 2.7.2 was accidentally published from a direct push to main, since reverted, so the next release number is 2.7.3.

Link to Devin session: https://app.devin.ai/sessions/217c81a67bbd4cd381366a5adf7356d9
Requested by: @pmckelvy1

Co-Authored-By: Patrick <patrick.mckelvy@reserve.org>
@pmckelvy1 pmckelvy1 self-assigned this Jul 24, 2026
@devin-ai-integration

Copy link
Copy Markdown
Contributor Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR that start with 'DevinAI' or '@devin'.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment, CI, and merge conflict monitoring

@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying react-zapper with  Cloudflare Pages  Cloudflare Pages

Latest commit: 4d90180
Status: ✅  Deploy successful!
Preview URL: https://a34579b8.react-zapper.pages.dev
Branch Preview URL: https://devin-1784923622-price-refre.react-zapper.pages.dev

View logs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant